package recreate;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;

public class RecreateDatabase {
	public static void main(String[] args) {
		try {
			// connection to MySQL
			Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
			Connection connection = DriverManager.getConnection(
					"jdbc:sqlserver://localhost:1433", "sa", "ponyhest");

			Statement stmt = connection.createStatement();
			stmt.executeUpdate("DROP DATABASE Carletti");
			stmt.executeUpdate("CREATE DATABASE Carletti");

			System.out.println("Database recreated!");
		} catch (Exception e) {
			System.out.println("Error connecting to database:  "
					+ e.getMessage());
		}
	}
}
